﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HFController;

namespace HFWebManage.Answer
{
    public partial class AnswerList : HFController.BagePages
    {
        /// <summary>
        /// 列表
        /// </summary>
        public List<hf.Model.Answer> list = new List<hf.Model.Answer>();
        protected void Page_Load(object sender, EventArgs e)
        {
            string PageStr = "";
            list = AnswerController.getController().getAnswerList(out PageStr);
            pager.Text = PageStr;

            string Action = this.GetQuery("action");
            switch (Action)
            {
                case "delete": //单个删除
                    int ID = int.Parse(this.GetQuery("ID"));
                    AnswerController.getController().doDelegeAnswer(ID);
                    break;
                case "deleteall": //批量删除
                    string IDS = this.GetAll("cid1");
                    AnswerController.getController().doDelegeAnswer(IDS.Split(','));
                    break;
            }
        }

        /// <summary>
        /// 获得律师UID
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public string getLawyerUID(int ID)
        {
            //得到事务
            hf.Model.Lawyer model = LawyerController.getController().getLawyerModel(ID);
            //返回标题
            return model.UID;
        }

        /// <summary>
        /// 获得提问名称
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public string getAskTitle(int ID)
        {
            //得到事务
            hf.Model.Ask model = AskController.getController().getAskModel(ID);
            //返回标题
            return model.Title;
        }
    }
}